<html lang="zh"><head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <title>新增请假申请</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="/css/bootstrap.min.css" rel="stylesheet">
    <link href="/css/font-awesome.min.css" rel="stylesheet">
    <!-- bootstrap-table 表格插件样式 -->
    <link href="/ajax/libs/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="/css/animate.css" rel="stylesheet">
    <link href="/css/style.css" rel="stylesheet">
    <link href="/feitian/css/ry-ui.css" rel="stylesheet">


    <link href="/ajax/libs/datapicker/bootstrap-datetimepicker.min.css" rel="stylesheet">

    <link rel="stylesheet" href="/ajax/libs/layer/theme/default/layer.css?v=3.1.1" id="layuicss-layer"><link rel="stylesheet" href="/ajax/libs/layer/theme/moon/style.css" id="layuicss-thememoonstylecss"></head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-leave-update" novalidate="novalidate">
        <div class="form-group">
            <label class="col-sm-3 control-label">用户id：</label>
            <div class="col-sm-8">
                <input name="userId" class="form-control" type="text" required="" aria-required="true">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">请假类型</label>
            <div class="col-sm-8">
                <div class="col-sm-8">
                    <select name="type" class="form-control m-b">
                        <option value="1">病假</option>
                        <option value="2">事假</option>
                        <option value="3">婚假</option>
                        <option value="4">丧假</option>
                        <option value="5">产假</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">请假开始时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="startTime" class="form-control" placeholder="yyyy-MM-dd" type="text" required="" aria-required="true">
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">请假结束时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="endTime" class="form-control" placeholder="yyyy-MM-dd" type="text" required="" aria-required="true">
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">批准状态：</label>
                <div class="col-sm-8">
                    <div class="radio-box">
                        <select name="status">
                            <option value="">所有</option>
                            <option value="1">待审批</option>
                            <option value="2">已批准</option>
                            <option value="3">已取消</option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="layui-layer-btn layui-layer-btn-">
                <a class="layui-layer-btn0" id="save">确定</a>
                <a class="layui-layer-btn1" id="back">关闭</a>
            </div>
        </div>
    </form>

    <script src="/js/jquery.min.js"></script>
    <script src="/js/bootstrap.min.js"></script>
    <script src="/ajax/libs//datapicker/bootstrap-datetimepicker.min.js"></script>
    <script>
        $(function(){
            init();
            update();
        })
        var id=location.search;
        function init(){
            $.ajax({
                url:"/system/leave/getleavebyid"+id,
                dataType:"json",
                type:"POST",
                async:false,
                success:function(data){
                    $("#form-leave-update [name=userId]").val(data.userId);
                    $("#form-leave-update [name=type]").val(data.type);
                    $("#form-leave-update [name=startTime]").val(data.startTime);
                    $("#form-leave-update [name=endTime]").val(data.endTime);
                    $("#form-leave-update [name=status]").val(data.status);
                }
            })
        }
        function update(){
            $("#save").click(function(){
                $.ajax({
                    url:"/system/leave/doupdate"+id,
                    type:"POST",
                    data:$("#form-leave-update").serialize(),
                    success:function(data){
                        if (data>0){
                            alert("修改成功！")
                            location.href="/system/leave"
                        }
                    }
                })
            })
            $("#back").click(function (){
                location.href="/system/leave"
            })
        }
    </script>
    <script type="text/javascript">
        $("input[name='startTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='endTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    </script>

</div>

</body>
</html>